package com.edu.neusoft.elec_shop.mapper;

import com.edu.neusoft.elec_shop.domain.ShoppingCart;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;
@Mapper
public interface ShoppingCartMapper {

    // 用户向购物车内添加商品
    int addToShoppingCart(ShoppingCart shoppingCart);
    ShoppingCart selectByUserIdAndGoodsId( @Param("userId") Long userId, @Param("goodsId") Long goodsId);
    int updateByPrimaryKeySelective(ShoppingCart record);
    int insert(ShoppingCart record);


    //将商品移出购物车
    int deleteByGoodsId(Long cartId);


    // 根据用户ID获取购物车列表
    List<ShoppingCart> getShoppingCartByUserId(Long userId);




}